home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 6242 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.une.edu.au!usenet
  2. From: Jon Snow <jwilkie@turing.une.edu.au>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: newing char**
  5. Date: 11 Feb 1996 23:03:43 GMT
  6. Organization: University of New England
  7. Message-ID: <4flskf$2i3@grivel.une.edu.au>
  8. References: <4fggal$4pf@darkstar.UCSC.EDU> <4fje7o$dl2@Milpitas01.Pop.Internex.NET>
  9. NNTP-Posting-Host: turing.une.edu.au
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; OSF1 V2.0 alpha)
  14. X-URL: news:4fje7o$dl2@Milpitas01.Pop.Internex.NET
  15.  
  16. Artyom@kansmen.com (Art Shelest) wrote:
  17. >In article <4fggal$4pf@darkstar.UCSC.EDU>,
  18. >   jono@cse.ucsc.edu (Jonathan Gibbs) wrote:
  19. >>If I have the following declaration:
  20. >>
  21. >>char **name;
  22. >>
  23. >>The following line compiles fine with g++, but I get the following 
  24. >>error on SGI's CC. Which is right?
  25. >>
  26. >>int num; 
  27. >>name = new (char*)[num];
  28. >>for (int i=0; i < num; i++) {
  29. >>   name = new char[25];
  30. >>}  ^^^^^^^
  31. >
  32. >Maybe you meant name[i] = ...
  33. >
  34. >   _Art.
  35.  
  36. And don't forget to initialise num to something before:
  37.        name = new (char*)[num];
  38.  
  39. Regards Jon
  40.  
  41.